package cn.hdustea.shopNavigation.ui.model

import cn.hdustea.shopNavigation.entity.UserEntity
import cn.hdustea.shopNavigation.net.MyService
import cn.hdustea.shopNavigation.ui.contract.AccountContract
import com.hdustea.base.base.BaseModel
import com.hdustea.base.net.BaseCallback
import com.hdustea.base.net.BaseObserver

class AccountModel : BaseModel(), AccountContract.Model {
    override fun login(username: String, password: String, callback: BaseCallback<UserEntity>) {
        changeThread(MyService.accountService().login(username, password), object :
                BaseObserver<UserEntity>(callback) {
            override fun onNext(t: UserEntity) {
                callback.callback(t)
            }
        })
    }

    override fun register(username: String, password: String, phone: String, callback: BaseCallback<Result<String>>) {
        TODO("Not yet implemented")
    }
}